package com.bsth.entity.realcontrol;

import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.*;
import java.util.Date;


/**
 * 
 * @ClassName: ChildTaskPlan
 * @Description: TODO(子任务)
 * @author PanZhao
 * @date 2016年6月20日 上午11:22:22
 *
 */
@Entity
@Table(name = "bsth_c_s_child_task")
@NamedEntityGraphs({
    @NamedEntityGraph(name = "childTaskPlan_schedule", attributeNodes = {
            @NamedAttributeNode("schedule")
    })
})
public class ChildTaskPlan {

	@Id
	@GeneratedValue
	private Long id;

	/**
	 * 任务类型1
	 * 正常，临加
	 */
	private String type1;

	/**
	 * 任务类型2
	 */
	private String type2;

	/**
	 * 起点
	 */
	private String startStation;
	
	/**
	 * 起点站名称
	 */
	private String startStationName;
	
	/**
	 * 终点
	 */
	private String endStation;
	
	/**
	 * 终点站名称
	 */
	private String endStationName;

	/**
	 * 里程类型
	 */
	private String mileageType;

	/**
	 * 里程
	 */
	private Float mileage;

	/**
	 * 开始时间 HH:mm
	 */
	private String startDate;

	/**
	 * 结束时间 HH:mm
	 */
	private String endDate;

	/**
	 * 是否烂班
	 */
	private boolean destroy;

	/**
	 * 烂班原因
	 */
	private String destroyReason;

	/** 创建日期 */
	@Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
	private Date createDate;

	/**
	 * 主排班计划
	 */
	@JsonIgnore
	@ManyToOne(fetch = FetchType.LAZY)
	private ScheduleRealInfo schedule;
	
	private String remarks;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getType1() {
		return type1;
	}

	public void setType1(String type1) {
		this.type1 = type1;
	}

	public String getType2() {
		return type2;
	}

	public void setType2(String type2) {
		this.type2 = type2;
	}

	public String getStartStation() {
		return startStation;
	}

	public void setStartStation(String startStation) {
		this.startStation = startStation;
	}

	public String getEndStation() {
		return endStation;
	}

	public void setEndStation(String endStation) {
		this.endStation = endStation;
	}

	public String getMileageType() {
		return mileageType;
	}

	public void setMileageType(String mileageType) {
		this.mileageType = mileageType;
	}

	public Float getMileage() {
		return mileage;
	}

	public void setMileage(Float mileage) {
		this.mileage = mileage;
	}

	public String getStartDate() {
		return startDate;
	}

	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}

	public String getEndDate() {
		return endDate;
	}

	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}

	public boolean isDestroy() {
		return destroy;
	}

	public void setDestroy(boolean destroy) {
		this.destroy = destroy;
	}

	public String getDestroyReason() {
		return destroyReason;
	}

	public void setDestroyReason(String destroyReason) {
		this.destroyReason = destroyReason;
	}

	public ScheduleRealInfo getSchedule() {
		return schedule;
	}

	public void setSchedule(ScheduleRealInfo schedule) {
		this.schedule = schedule;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public String getStartStationName() {
		return startStationName;
	}

	public void setStartStationName(String startStationName) {
		this.startStationName = startStationName;
	}

	public String getEndStationName() {
		return endStationName;
	}

	public void setEndStationName(String endStationName) {
		this.endStationName = endStationName;
	}

	@Override
	public int hashCode() {
		return ("cTask" + this.getId() + this.getSchedule().getId()).hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		return this.id.equals(((ChildTaskPlan)obj).getId());
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
}
